package com.tencent.wxcloudrun.controller;

import com.tencent.wxcloudrun.config.ApiResponse;
import com.tencent.wxcloudrun.model.MyRemind;
import com.tencent.wxcloudrun.service.MyRemindService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/remind")
public class MyRemindController {

    @Autowired
    private MyRemindService remindService;
    final Logger logger = LoggerFactory.getLogger(MyRemindController.class);

    @PostMapping(value = "/list")
    ApiResponse getInfoList(@RequestParam("userId") String userId) {
//        logger.info("/api/count get request");
//        logger.info(param.toString());
        List<MyRemind> list= remindService.findByUserId(userId);
//        Integer count = 0;
//        if (counter.isPresent()) {
//            count = counter.get().getCount();
//        }

        return ApiResponse.ok(list);
    }
    @PostMapping(value = "/add")
    public ApiResponse addRemind(@RequestBody MyRemind request){
        remindService.insertSelective(request);
        return ApiResponse.ok();
    }


}
